'use strict';

let {Sequelize,DataTypes}=require('sequelize');
let {database,username,password,host,dialect}=require('./config')

let seq=new Sequelize(database,username,password,{
    host:host,
    dialect:dialect
});

function defineModel(name,obj){
    let prop={};
    prop.id={
        type:DataTypes.BIGINT,
        primaryKey:true,
        autoIncrement: true
    };
    for(let key in obj){
        prop[key]=obj[key];
    }
    prop.remarks={
        type:DataTypes.STRING(800)
    }

    let model=seq.define(name,prop);
    return model;
}
let obj={
    seq,
    defineModel,
    DataTypes
}
module.exports=obj;